// TODO: what if the number of parameters is unstable?
function normal2curry(callback) {

  let argsArray = [];
  let funcLen = callback.length;

  return function circle(...rest) {
    
    argsArray = argsArray.concat(rest);

    if (argsArray.length === funcLen) {
      callback(...argsArray);
    } else {
      return circle;
    }

  }
}

function test1(a, b, c, d) {
  console.log(a, b , c, d);
  console.log(a + b + c + d);
}

let test2 = normal2curry(test1);
test1(1, 2, 3, 4);
test2(1)(2)(3)(4);